#***************************************************************************************************************** # # AdoScript File of Industrial_Business_Process_Management_ADOxx15-v0.3.0 Application Library # # AdoScript for updating Bill of part/materials used in a station (Group Object) automatically either from # referenced Industrial Business Process or parts modelled inside of station # #------------------------- GENERAL FILE INFOS -------------------------------------------------------------------- # # APPLIES TO: Industrial Business Process Management Toolkit V:1.0 # FILE VERSION: 1.0 # AUTHOR: NEF (BOC AM) # #--------------------------- FILE DEPENDENCIES ------------------------------------------------------------------- # # INCLUDING FILES: None # # INCLUDED BY: None # #--------------------------- READ BEFORE EDIT -------------------------------------------------------------------- # # --- File History --- # # [NEF, 09.11.2017] # - initial version for Industrial Business Process Management Toolkit # # USAGE: The mechanism triggered by PROGRAMCALL type attribute 'Update Bill of Materials' # through NOTEBOOK of selected 'Group' object. # # REMARKS: - Industrial_Business_Process_Management_ADOxx15-v0.3.0 Application Library is based # on StartingPoint_BPMN2-0_ADOxx1-3-UL1_v1-01.abl # (https://www.adoxx.org/svn/all-repo/4_StartingPoint_BPMN2.0_ADOxx13UL1/BIN/StartingPoint_BPMN2-0_ADOxx1-3-UL1_v1-01.abl) # provided by ADOxx.org. # # - CLASS 'Group' from BPMN implementation on ADOxx represents stations in production processes # This design decision is based on the rationale to modify initial BPMN implementation on # ADOxx as less as possible. # #----------------------------------------------------------------------------------------------------------------- #***************************************************************************************************************** SET nCurrentGroupObjid:(objid) CC "Core" GET_MODEL_ID objid:(nCurrentGroupObjid) SET nCurrentModelID:(modelid) CC "Core" GET_CLASS_ID classname: ("Group") SET nGroupClassId: (classid) CC "Core" GET_OBJ_NAME objid: (nCurrentGroupObjid) SET sGroupObjname:(objname) CC "Core" GET_ATTR_ID classid:(nGroupClassId) attrname:("Bill of Materials") SET nBOMRecAttrid:(attrid) CC "Core" GET_REC_CLASS_ID classname:("Bill of Materials") #--> RESULT ecode: intValue classid: id . SET nBOMRecClassid:(classid) CC "Core" GET_ATTR_ID classid: (nBOMRecClassid) attrname: ("Material name") SET nMaterialNameAttrId: (attrid) CC "Core" GET_ATTR_ID classid: (nBOMRecClassid) attrname: ("Available quantity") SET nAvailableQuantityAttrId: (attrid) CC "Core" GET_ATTR_ID classid: (nBOMRecClassid) attrname: ("Required quantity") SET nRequiredQuantityAttrId: (attrid) CC "Core" GET_ATTR_VAL objid: (nCurrentGroupObjid) attrname: ("Referenced industrial business process") format: "%m" SET sReferencedIBP:(val) #if there is no referenced Industrial Business Process to the station, update BoM based on parts/materials # and parts & material flows modelled within the station IF (sReferencedIBP = "") { #Clean bill of materials CC "Core" GET_REC_ATTR_ROW_COUNT objid:(nCurrentGroupObjid) attrid:(nBOMRecAttrid) SET nBOMRecRowCount:(count) FOR i from:(nBOMRecRowCount) to:(1) by:(-1) { CC "Core" GET_REC_ATTR_ROW_ID objid:(nCurrentGroupObjid) attrid:(nBOMRecAttrid) index:(i) #--> RESULT ecode: intValue rowid: id . CC "Core" REMOVE_REC_ROW objid:(nCurrentGroupObjid) attrid:(nBOMRecAttrid) rowid:(rowid) #--> RESULT ecode: intValue . } CC "AQL" EVAL_AQL_EXPRESSION expr: ("({\""+sGroupObjname+"\":\"Group\"}<-\"Is inside\">\"Parts\"<)") modelid: (nCurrentModelID) SET lPartsNodeList:(objids) FOR sPartNode in: (lPartsNodeList) { SET nPartNode: (VAL sPartNode) #Create new row in BoM CC "Core" ADD_REC_ROW objid:(nCurrentGroupObjid) attrid:(nBOMRecAttrid) #--> RESULT ecode: intValue rowid: id . SET nBOMRecRowId:(rowid) #Set Material name in row CC "Core" GET_ATTR_VAL objid: (nPartNode) attrname: ("Name") SETL sMaterialName: (val) CC "Core" SET_ATTR_VAL objid:(nBOMRecRowId) attrid:(nMaterialNameAttrId) val:(sMaterialName) #Set Available quantity in row CC "Core" GET_ATTR_VAL objid: (nPartNode) attrname: ("Available quantity") SETL nAvailableQuantity: (val) CC "Core" SET_ATTR_VAL objid:(nBOMRecRowId) attrid:(nAvailableQuantityAttrId) val:(nAvailableQuantity) #Set Required quantity in row CC "Core" GET_OBJ_NAME objid: (nPartNode) SET sPartName: (objname) SET nRequiredQuantity:0 CC "AQL" EVAL_AQL_EXPRESSION expr: ("({\""+sPartName+"\"}-><\"Parts flow\">)") modelid: (nCurrentModelID) SET lPartsFlowConnectorsList: (objids) FOR sPartsFlowConnector in: (lPartsFlowConnectorsList) { SET nPartsFlowConnector: (VAL sPartsFlowConnector) CC "Core" GET_ATTR_VAL objid: (nPartsFlowConnector) attrname: ("Quantity") SET nRequiredQuantity: (nRequiredQuantity+val) } CC "Core" SET_ATTR_VAL objid:(nBOMRecRowId) attrid:(nRequiredQuantityAttrId) val:(nRequiredQuantity) CC "AdoScript" SLEEP ms:100 } } #if there is a referenced Industrial Business Process to the station, read all the part/materials #and parts & material flows from referenced Industrial Business Process and update BoM based on them ELSE { CC "AdoScript" WARNINGBOX "Bill of Materials will be updated from\nReferenced Industrial Business Process" ok-cancel IF (endbutton = "ok") { #Clean bill of materials CC "Core" GET_REC_ATTR_ROW_COUNT objid:(nCurrentGroupObjid) attrid:(nBOMRecAttrid) SET nBOMRecRowCount:(count) FOR i from:(nBOMRecRowCount) to:(1) by:(-1) { CC "Core" GET_REC_ATTR_ROW_ID objid:(nCurrentGroupObjid) attrid:(nBOMRecAttrid) index:(i) #--> RESULT ecode: intValue rowid: id . CC "Core" REMOVE_REC_ROW objid:(nCurrentGroupObjid) attrid:(nBOMRecAttrid) rowid:(rowid) #--> RESULT ecode: intValue . } CC "Core" GET_MODEL_ID modelname: (sReferencedIBP) modeltype: ("Business process diagram (BPMN 2.0)") SET nSubIBPid:(modelid) CC "Core" LOAD_MODEL modelid: (nSubIBPid) read-access CC "AQL" EVAL_AQL_EXPRESSION expr: ("(<\"Parts\">)") modelid: (nSubIBPid) SET lPartsNodeList:(objids) FOR sPartNode in: (lPartsNodeList) { SET nPartNode: (VAL sPartNode) #Create new row in BoM CC "Core" ADD_REC_ROW objid:(nCurrentGroupObjid) attrid:(nBOMRecAttrid) #--> RESULT ecode: intValue rowid: id . SET nBOMRecRowId:(rowid) #Set Material name in row CC "Core" GET_ATTR_VAL objid: (nPartNode) attrname: ("Name") SETL sMaterialName: (val) CC "Core" SET_ATTR_VAL objid: (nBOMRecRowId) attrid: (nMaterialNameAttrId) val: (sMaterialName) #Set Available quantity in row CC "Core" GET_ATTR_VAL objid: (nPartNode) attrname: ("Available quantity") SETL nAvailableQuantity: (val) CC "Core" SET_ATTR_VAL objid:(nBOMRecRowId) attrid:(nAvailableQuantityAttrId) val:(nAvailableQuantity) #Set Required quantity in row CC "Core" GET_OBJ_NAME objid: (nPartNode) SET sPartName: (objname) SET nRequiredQuantity:0 CC "AQL" EVAL_AQL_EXPRESSION expr: ("({\""+sPartName+"\"}-><\"Parts flow\">)") modelid: (nSubIBPid) SET lPartsFlowConnectorsList: (objids) FOR sPartsFlowConnector in: (lPartsFlowConnectorsList) { SET nPartsFlowConnector: (VAL sPartsFlowConnector) CC "Core" GET_ATTR_VAL objid: (nPartsFlowConnector) attrname: ("Quantity") SET nRequiredQuantity: (nRequiredQuantity+val) } CC "Core" SET_ATTR_VAL objid:(nBOMRecRowId) attrid:(nRequiredQuantityAttrId) val:(nRequiredQuantity) CC "AdoScript" SLEEP ms:100 } } ELSE { EXIT } }